package cn.xz.gobang.util

import android.animation.Animator
import android.animation.IntEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.graphics.Typeface
import android.os.Build
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import cn.xz.gobang.base.BaseApplication


/**
 * @Author: QuYunShuo
 * @Time: 2020/9/1
 * @Class: ViewKtx
 * @Remark: View相关的扩展方法
 */

/*************************************** View可见性相关 ********************************************/
/**
 * 隐藏View
 */
fun View.gone() {
    visibility = View.GONE
}

/**
 * 显示View
 * @receiver View
 */
fun View.visible() {
    visibility = View.VISIBLE
}

/**
 * View不可见但存在原位置
 */
fun View.invisible() {
    visibility = View.INVISIBLE
}

/**
 * 判断View是不是[View.VISIBLE]状态
 */
val View.isVisible: Boolean
    get() {
        return visibility == View.VISIBLE
    }

/**
 * 判断View是不是[View.INVISIBLE]状态
 */
val View.isInvisible: Boolean
    get() {
        return visibility == View.INVISIBLE
    }

/**
 * 判断View是不是[View.GONE]状态
 */
val View.isGone: Boolean
    get() {
        return visibility == View.GONE
    }

/**
 * 设置个性字体*/
fun TextView.setZT() {
    val typeface = Typeface.createFromAsset(context.assets, "AlimamaDaoLiTi.ttf")
    this.typeface = typeface
}

